package com.gastudio.Protocol;

import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.core.session.IoSession;

/**
 * Created by 余艾龙 on 2017/6/21.
 */
public class ProtocolClientHandler extends IoHandlerAdapter {
    @Override
    public void sessionIdle(IoSession session, IdleStatus status) throws Exception {
        if(status==IdleStatus.READER_IDLE){
            session.close(true);
        }
    }

    @Override
    public void messageReceived(IoSession session, Object message) throws Exception {
        ProtocolPack pack=(ProtocolPack) message;
        System.out.println("客户端->"+pack);
    }
}
